class A(object):
    aa = 1
    def __init__(self, name, age):
        self.name = name
        self.age = age
        
        
    def __getattribute__(self, name):
        print('----  __getattribute__  ---')
        if name == 'name':
            return self.name  # self.name  等价于  self.__getattribute__(name)  所以会无限递归
        elif name == 'age':
            return self.age
        else:
            raise ArithmeticError
            
    def __getattr__(self, name):
        print('----  __getattr__  ---')
        if name == 'info':
            return self.name, self.age
        else:
            raise AttributeError

a = A('aa', 1)